#include <stdio.h>

void qsort(int a[], int s, int e) {
	int i, j, t;
	i = s; j = e; t = a[s];
	if (s > e) return;
	while (i != j) {
		while (a[j] >= t && j > i) j--;
		if (j > i) a[i++] = a[j];
		while (a[i] <= t && j > i) i++;
		if (j > i) a[j--] = a[i];
	}

	a[i] = t;

	qsort(a, s, i-1);
	qsort(a, i+1, e);
}

int main(int argc, char *argv[])
{
	int w, n, a[30000], cnt;
	int i, j, t, ps, pe;

	scanf("%d", &w);
	scanf("%d", &n);
	for (i=0; i<n; i++) {
		scanf("%d", &a[i]);
	}

	qsort(a, 0, n-1);

	ps = 0;
	pe = n-1;
	cnt = 0;
	while (1) {
		if (ps > pe) break;
		if (ps == pe) {
			cnt++;
			break;
		}
		if ((a[ps] + a[pe]) > w) {
			cnt++;
			pe--;
		} else {
			cnt++;
			ps++; pe--;
		}
	}

	printf("%d\n", cnt);

	return 0;
}
